/*
 * Copyright (c) 2010-2013 Ruben Chakhmakhchyan. All rights reserved.
 * 
 * This file contains Original Code and/or Modifications of Original Code
 * as defined in and that are subject to the Eclipse Public License
 * Version 1.0 (the 'License'). You may not use this file except in
 * compliance with the License. Please obtain a copy of the License at
 * http://opensource.org/licenses/EPL-1.0 and read it before using this file.
 */

#include "convert.h"
#include <stdlib.h>
#include <string.h>


int Convert::ToInt( const char* value )
{
    return ::atoi( value );
}

int Convert::ToInt( const wchar_t* value )
{
    return ::_wtoi( value );
}

char* Convert::ToString( int value )
{
    char* string = new char[ 16 ];

    ::memset(string, 0, 16);

    return ::_itoa( value, string, 10 );
}

char* Convert::ToString( const char* dest, int value )
{
    if ( dest == NULL )
        return NULL;

    return ::_itoa( value, const_cast<char*>( dest ), 10 );
}
